import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

let deviceInfo = uni.getSystemInfoSync()
let MenuButton = uni.getMenuButtonBoundingClientRect()
let titleHeight = MenuButton.height + (MenuButton.top - deviceInfo.statusBarHeight) * 2

const store = new Vuex.Store({
	state: {
		deviceInfo,
		statusBarHeight: deviceInfo.statusBarHeight, // 当前手机顶部paddingTop
		windowHeight: deviceInfo.windowHeight,
		windowWidth: deviceInfo.windowWidth,
		screenHeight: deviceInfo.screenHeight,
		titleHeight,
		tabIdx: 0
	},
	getters: {},
	mutations: {
		SET_TAB_IDX(state, payload) {
			state.tabIdx = payload;
		},
	},
	actions: {},
	modules: {}
});

export default store;
